<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class site extends CI_Controller {
	// ****** by liub 20141224
	
	// 关于我们
	function aboutus(){
		$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		$vdata['tab'] = "about";
		$vdata['sub_1'] = "关于我们";
		$vdata['sub_1_href'] = "/site/aboutus";
		$this->load->view("site/zhs_about" ,$vdata);
	}
	
	// 新手导航
	function zhs_help(){
		$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		$vdata['tab'] = "help_guide";
		$vdata['sub_1'] = "新手指引";
		$vdata['sub_1_href'] = "/site/zhs_help.html";
		$this->load->view("site/zhs_help" ,$vdata);
	}
	
	// 安全保证
	function zhs_safe(){
		$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		$vdata['tab'] = "safe";
		$vdata['sub_1'] = "安全保障";
		$vdata['sub_1_href'] = "/site/zhs_safe.html";
		$this->load->view("site/zhs_safe" ,$vdata);
	}
	
	function zhs_zhsjr($id,$ten_id = 0){//
		$this->load->model('site_model');
		
		$guide = $this->site_model->get_site_one(array('id'=>'5','is_del'=>'0'),' id,title '); //新手导航
		if(isset($guide['id'])) $guidess = $this->site_model->get_site_category_by_pid($guide['id'],' id,title '); //子菜单
		
		$help = $this->site_model->get_site_one(array('id'=>'4','is_del'=>'0'),' id,title '); //帮助中心
		if(isset($help['id'])) $helpss = $this->site_model->get_site_category_by_pid($help['id'],' id,title '); // 子菜单
		
		$safe = $this->site_model->get_site_one(array('id'=>'2','is_del'=>'0'),' id,title '); //安全保障
		if(isset($safe['id'])) $safess = $this->site_model->get_site_category_by_pid($safe['id'],' id,title '); // 子菜单
		
		$aboutus = $this->site_model->get_site_one(array('id'=>'1','is_del'=>'0'),' id,title '); //关于我们
		if(isset($aboutus['id'])) $aboutuss = $this->site_model->get_site_category_by_pid($aboutus['id'],' id,title '); // 子菜单
		
		if($id > 0){
			$content = $this->site_model->get_site_one(array('id'=>$id,'is_del'=>'0'),' id,title,content,parent_id,type_set,url '); 
		}
		if(!$content){
			$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		}
		
		$user = $this->session->userdata('rsh_user');
		if($id == '29' && isset($user['user_id']) && $ten_id>0){//针对协议
			$this->load->model('Borrow_model');
			$adata['where']['user_id'] = $user['user_id'];
			$adata['where']['ten_id'] = $ten_id;
			$adata['limit'] = 'all';
			$tender_vdata= $this->Borrow_model->borrow_tender_user_list($adata);
			$tender = $tender_vdata['tender_list'][0];
			if(!$tender){
				$this->js->alert('请求页面不存在');
				$this->js->go("/site/zhs_zhsjr/".$id.".html");
				exit;
			}
			/*$borrow_bill_bank = $this->Borrow_model->arrays('borrow_bill_bank');//银行
			$bank = $this->bank->get_by_uid($tender['borr_user_id']);
			$bank_id = 0;
			if(count($bank)>= 1) {
				if(isset($bank[1]) && $bank[1]['default_flag'] == '1') $bank_id = $bank[1]['bank'];
				else $bank_id = $bank[0]['bank'];
			}*/
			$borrow_style = $this->Borrow_model->arrays('borrow_style');
			$this->load->model('User_model', 'user');
			$borr_user = $this->user->get_by_uid($tender['borr_user_id']);
			$this->load->model('Conset_model', 'conset');
			$conset = $this->conset->get_conset_use_obj($tender['fuse']);
			$protocol_id = "YDT-JK".$tender['add_time'];	//协议编号
			$protocol_id1 = "YDT-WT".$tender['add_time'];
			$huan_date =date("Y-m-d H:i:s",$tender['bill_starttime']);  //还款日期
			if($tender['is_day'] == '1') {
				$huan_date =date("Y-m-d H:i:s",$tender['bill_starttime']);  
				$huan_date = date('Y-m-d H:i:s',strtotime($huan_date . '+'.$tender['time_limit_day'].' day'));
			}
			else {
				$huan_date =date("Y-m-d H:i:s",$tender['bill_starttime']);  
				$huan_date = date('Y-m-d H:i:s',strtotime($huan_date . '+'.$tender['time_limit'].' month'));
			}
			
			//借款人身份证号掩盖
			if($borr_user['card_id']){
				$borr_user['card_id']=strdisplay_start($borr_user['card_id'],2);
			}
			//借款人账号掩盖
			if($borr_user['username']){
				$borr_user['username']=strdisplay_start($borr_user['username'],2);
			}
			//投资人身份证号掩盖
			if($tender['card_id']){
				$tender['card_id']=strdisplay_start($tender['card_id'],2);
			}
			//投资人帐号掩盖
			if($tender['username']){
				$tender['username']=strdisplay_start($tender['username'],2);
			}

			$content['content'] = str_replace ( array ('#protocol_id#','#realname#','#card_id#','#username#','#realname1#','#card_id1#','#username1#'
						,'#money#','#bill_starttime#','#time_limit#','#huan_date#','#apr#','#style#','#repayment_account#',
						'#interest#','#repayment_yesaccount#','#repayment_yesinterest#','#wait_account#','#wait_interest#'), 
						array ($protocol_id,$tender['realname'],$tender['card_id'],$tender['username'],$borr_user['realname'],$borr_user['card_id'],$borr_user['username'],$tender['money'],date('Y-m-d',$tender['bill_starttime']),$tender['time_limit'],date('Y-m-d',strtotime($huan_date)),$tender['apr'],$borrow_style[$tender['style']],
						$tender['rep_ment'],$tender['interest'],$tender['repayment_yesaccount'],$tender['repayment_yesinterest'],$tender['wait_account'],$tender['wait_interest']), 
						$content['content']);
		}
		
		if($content['type_set'] == 1){
			$this->load->model('article_model');
			$cdata['where']['nid'] = $content['id'];
				$article_list = $this->article_model->get_article_list_index_limit($cdata);
			
			$vdata['article_list'] = $article_list;
		}
		$vdata['guide'] = $guide;
		$vdata['guidess'] = $guidess;
		$vdata['help'] = $help;
		$vdata['helpss'] = $helpss;
		$vdata['safe'] = $safe;
		$vdata['safess'] = $safess;
		$vdata['aboutus'] = $aboutus;
		$vdata['aboutuss'] = $aboutuss;
		$vdata['content'] = $content;
		$vdata['zhs_sub'] = $id;
		$vdata['tab'] = "aboutus";
		$vdata['zhs_parent_id'] = $content['parent_id'];
		
		if($content['parent_id'] == 1){
			$vdata['aler1'] = $aboutus['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$aboutuss[0]['id'].".html";
		}elseif($content['parent_id'] == 2){
			$vdata['aler1'] = $safe['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$safess[0]['id'].".html";
		}elseif($content['parent_id'] == 4){
			$vdata['aler1'] = $help['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$helpss[0]['id'].".html";
		}elseif($content['parent_id'] == 5){
			$vdata['aler1'] = $guide['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$guidess[0]['id'].".html";
		}

		$vdata['aler2'] = $content['title'];
		$vdata['aler2_url'] = "/site/zhs_zhsjr/".$id.".html";
		$this->load->view("site/zhs_content" ,$vdata);
	}
	function article_view($id){
		$this->load->model('article_model');
		$index_gonggao_key = 'article_obj'.$id;
		
		$article_obj= $this->article_model->get_article_obj($id);
	
		if(!$article_obj){
			$this->js->alert('请求页面不存在'.$id);
			$this->js->go("/site/zhs_zhsjr/34.html");
			exit;
		}
		$this->load->model('site_model');
		
		$guide = $this->site_model->get_site_one(array('id'=>'5','is_del'=>'0'),' id,title '); //新手导航
		if(isset($guide['id'])) $guidess = $this->site_model->get_site_category_by_pid($guide['id'],' id,title '); //子菜单
		
		$help = $this->site_model->get_site_one(array('id'=>'4','is_del'=>'0'),' id,title '); //帮助中心
		if(isset($help['id'])) $helpss = $this->site_model->get_site_category_by_pid($help['id'],' id,title '); // 子菜单
		
		$safe = $this->site_model->get_site_one(array('id'=>'2','is_del'=>'0'),' id,title '); //安全保障
		if(isset($safe['id'])) $safess = $this->site_model->get_site_category_by_pid($safe['id'],' id,title '); // 子菜单
		
		$aboutus = $this->site_model->get_site_one(array('id'=>'1','is_del'=>'0'),' id,title '); //关于我们
		if(isset($aboutus['id'])) $aboutuss = $this->site_model->get_site_category_by_pid($aboutus['id'],' id,title '); // 子菜单
		
		$parent = $this->site_model->get_site_one(array('id'=>$article_obj['nid'],'is_del'=>'0'),' id,title,parent_id '); // 上一个级别
		
		
		$vdata['guide'] = $guide;
		$vdata['guidess'] = $guidess;
		$vdata['help'] = $help;
		$vdata['helpss'] = $helpss;
		$vdata['safe'] = $safe;
		$vdata['safess'] = $safess;
		$vdata['aboutus'] = $aboutus;
		$vdata['aboutuss'] = $aboutuss;
		$vdata['article_obj'] = $article_obj;
		$vdata['zhs_sub'] = $article_obj['nid'];
		$vdata['zhs_parent_id'] = $parent['parent_id'];
		
		if($parent['parent_id'] == 1){
			$vdata['aler1'] = $aboutus['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$aboutuss[0]['id'].".html";
		}elseif($parent['parent_id'] == 2){
			$vdata['aler1'] = $safe['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$safess[0]['id'].".html";
		}elseif($parent['parent_id'] == 4){
			$vdata['aler1'] = $help['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$helpss[0]['id'].".html";
		}elseif($parent['parent_id'] == 5){
			$vdata['aler1'] = $guide['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$guidess[0]['id'].".html";
		}

		$vdata['aler2'] = $parent['title'];
		$vdata['aler2_url'] = "/site/zhs_zhsjr/".$article_obj['nid'].".html";
		
		$this->load->view("site/zhs_article" ,$vdata);
	}
}
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class site extends CI_Controller {
    // ****** by liub 20141224
	
	// 关于我们
	function aboutus(){
		$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		$vdata['tab'] = "about";
		$vdata['sub_1'] = "关于我们";
		$vdata['sub_1_href'] = "/site/aboutus";
		$this->load->view("site/zhs_about" ,$vdata);
	}
	
	// 新手导航
	function zhs_help(){
		$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		$vdata['tab'] = "help_guide";
		$vdata['sub_1'] = "新手指引";
		$vdata['sub_1_href'] = "/site/zhs_help.html";
		$this->load->view("site/zhs_help" ,$vdata);
	}
	
	// 安全保证
	function zhs_safe(){
		$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		$vdata['tab'] = "safe";
		$vdata['sub_1'] = "安全保障";
		$vdata['sub_1_href'] = "/site/zhs_safe.html";
		$this->load->view("site/zhs_safe" ,$vdata);
	}
	
	function zhs_zhsjr($id,$ten_id = 0){//
		$this->load->model('site_model');
		
		$guide = $this->site_model->get_site_one(array('id'=>'5','is_del'=>'0'),' id,title '); //新手导航
		if(isset($guide['id'])) $guidess = $this->site_model->get_site_category_by_pid($guide['id'],' id,title '); //子菜单
		
		$help = $this->site_model->get_site_one(array('id'=>'4','is_del'=>'0'),' id,title '); //帮助中心
		if(isset($help['id'])) $helpss = $this->site_model->get_site_category_by_pid($help['id'],' id,title '); // 子菜单
		
		$safe = $this->site_model->get_site_one(array('id'=>'2','is_del'=>'0'),' id,title '); //安全保障
		if(isset($safe['id'])) $safess = $this->site_model->get_site_category_by_pid($safe['id'],' id,title '); // 子菜单
		
		$aboutus = $this->site_model->get_site_one(array('id'=>'1','is_del'=>'0'),' id,title '); //关于我们
		if(isset($aboutus['id'])) $aboutuss = $this->site_model->get_site_category_by_pid($aboutus['id'],' id,title '); // 子菜单
		
		if($id > 0){
			$content = $this->site_model->get_site_one(array('id'=>$id,'is_del'=>'0'),' id,title,content,parent_id,type_set,url '); 
		}
		if(!$content){
			$this->js->alert('请求页面不存在');
			$this->js->go("/site/zhs_zhsjr/".$aboutuss[0]['id'].".html");
			exit;
		}
		
		$user = $this->session->userdata('rsh_user');
		if($id == '29' && isset($user['user_id']) && $ten_id>0){//针对协议
			$this->load->model('Borrow_model');
			$adata['where']['user_id'] = $user['user_id'];
			$adata['where']['ten_id'] = $ten_id;
			$adata['limit'] = 'all';
			$tender_vdata= $this->Borrow_model->borrow_tender_user_list($adata);
			$tender = $tender_vdata['tender_list'][0];
			if(!$tender){
				$this->js->alert('请求页面不存在');
				$this->js->go("/site/zhs_zhsjr/".$id.".html");
				exit;
			}
			/*$borrow_bill_bank = $this->Borrow_model->arrays('borrow_bill_bank');//银行
			$bank = $this->bank->get_by_uid($tender['borr_user_id']);
			$bank_id = 0;
			if(count($bank)>= 1) {
				if(isset($bank[1]) && $bank[1]['default_flag'] == '1') $bank_id = $bank[1]['bank'];
				else $bank_id = $bank[0]['bank'];
			}*/
			$borrow_style = $this->Borrow_model->arrays('borrow_style');
			$this->load->model('User_model', 'user');
			$borr_user = $this->user->get_by_uid($tender['borr_user_id']);
			$this->load->model('Conset_model', 'conset');
			$conset = $this->conset->get_conset_use_obj($tender['fuse']);
			$protocol_id = "YDT-JK".$tender['add_time'];	//协议编号
			$protocol_id1 = "YDT-WT".$tender['add_time'];
			$huan_date =date("Y-m-d H:i:s",$tender['bill_starttime']);  //还款日期
			if($tender['is_day'] == '1') {
				$huan_date =date("Y-m-d H:i:s",$tender['bill_starttime']);  
				$huan_date = date('Y-m-d H:i:s',strtotime($huan_date . '+'.$tender['time_limit_day'].' day'));
			}
			else {
				$huan_date =date("Y-m-d H:i:s",$tender['bill_starttime']);  
				$huan_date = date('Y-m-d H:i:s',strtotime($huan_date . '+'.$tender['time_limit'].' month'));
			}
			
			//借款人身份证号掩盖
			if($borr_user['card_id']){
				$borr_user['card_id']=strdisplay_start($borr_user['card_id'],2);
			}
			//借款人账号掩盖
			if($borr_user['username']){
				$borr_user['username']=strdisplay_start($borr_user['username'],2);
			}
			//投资人身份证号掩盖
			if($tender['card_id']){
				$tender['card_id']=strdisplay_start($tender['card_id'],2);
			}
			//投资人帐号掩盖
			if($tender['username']){
				$tender['username']=strdisplay_start($tender['username'],2);
			}
			

			$content['content'] = str_replace ( array ('#protocol_id#','#realname#','#card_id#','#username#','#realname1#','#card_id1#','#username1#'
						,'#money#','#bill_starttime#','#time_limit#','#huan_date#','#apr#','#style#','#repayment_account#',
						'#interest#','#repayment_yesaccount#','#repayment_yesinterest#','#wait_account#','#wait_interest#'), 
						array ($protocol_id,$tender['realname'],$tender['card_id'],$tender['username'],$borr_user['realname'],$borr_user['card_id'],$borr_user['username']
						,$tender['money'],date('Y-m-d',$tender['bill_starttime']),$tender['time_limit'],date('Y-m-d',strtotime($huan_date)),$tender['apr'],$borrow_style[$tender['style']],
						$tender['rep_ment'],$tender['interest'],$tender['repayment_yesaccount'],$tender['repayment_yesinterest'],$tender['wait_account'],$tender['wait_interest']), 
						$content['content']);
		}
		
		if($content['type_set'] == 1){
			$this->load->model('article_model');
			$cdata['where']['nid'] = $content['id'];
				$article_list = $this->article_model->get_article_list_index_limit($cdata);
			
			$vdata['article_list'] = $article_list;
		}
		$vdata['guide'] = $guide;
		$vdata['guidess'] = $guidess;
		$vdata['help'] = $help;
		$vdata['helpss'] = $helpss;
		$vdata['safe'] = $safe;
		$vdata['safess'] = $safess;
		$vdata['aboutus'] = $aboutus;
		$vdata['aboutuss'] = $aboutuss;
		$vdata['content'] = $content;
		$vdata['zhs_sub'] = $id;
		$vdata['tab'] = "aboutus";
		$vdata['zhs_parent_id'] = $content['parent_id'];
		
		if($content['parent_id'] == 1){
			$vdata['aler1'] = $aboutus['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$aboutuss[0]['id'].".html";
		}elseif($content['parent_id'] == 2){
			$vdata['aler1'] = $safe['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$safess[0]['id'].".html";
		}elseif($content['parent_id'] == 4){
			$vdata['aler1'] = $help['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$helpss[0]['id'].".html";
		}elseif($content['parent_id'] == 5){
			$vdata['aler1'] = $guide['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$guidess[0]['id'].".html";
		}

		$vdata['aler2'] = $content['title'];
		$vdata['aler2_url'] = "/site/zhs_zhsjr/".$id.".html";
		$this->load->view("site/zhs_content" ,$vdata);
	}
	function article_view($id){
		$this->load->model('article_model');
		$index_gonggao_key = 'article_obj'.$id;
		
		$article_obj= $this->article_model->get_article_obj($id);
	
		if(!$article_obj){
			$this->js->alert('请求页面不存在'.$id);
			$this->js->go("/site/zhs_zhsjr/34.html");
			exit;
		}
		$this->load->model('site_model');
		
		$guide = $this->site_model->get_site_one(array('id'=>'5','is_del'=>'0'),' id,title '); //新手导航
		if(isset($guide['id'])) $guidess = $this->site_model->get_site_category_by_pid($guide['id'],' id,title '); //子菜单
		
		$help = $this->site_model->get_site_one(array('id'=>'4','is_del'=>'0'),' id,title '); //帮助中心
		if(isset($help['id'])) $helpss = $this->site_model->get_site_category_by_pid($help['id'],' id,title '); // 子菜单
		
		$safe = $this->site_model->get_site_one(array('id'=>'2','is_del'=>'0'),' id,title '); //安全保障
		if(isset($safe['id'])) $safess = $this->site_model->get_site_category_by_pid($safe['id'],' id,title '); // 子菜单
		
		$aboutus = $this->site_model->get_site_one(array('id'=>'1','is_del'=>'0'),' id,title '); //关于我们
		if(isset($aboutus['id'])) $aboutuss = $this->site_model->get_site_category_by_pid($aboutus['id'],' id,title '); // 子菜单
		
		$parent = $this->site_model->get_site_one(array('id'=>$article_obj['nid'],'is_del'=>'0'),' id,title,parent_id '); // 上一个级别
		
		
		$vdata['guide'] = $guide;
		$vdata['guidess'] = $guidess;
		$vdata['help'] = $help;
		$vdata['helpss'] = $helpss;
		$vdata['safe'] = $safe;
		$vdata['safess'] = $safess;
		$vdata['aboutus'] = $aboutus;
		$vdata['aboutuss'] = $aboutuss;
		$vdata['article_obj'] = $article_obj;
		$vdata['zhs_sub'] = $article_obj['nid'];
		$vdata['zhs_parent_id'] = $parent['parent_id'];
		
		if($parent['parent_id'] == 1){
			$vdata['aler1'] = $aboutus['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$aboutuss[0]['id'].".html";
		}elseif($parent['parent_id'] == 2){
			$vdata['aler1'] = $safe['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$safess[0]['id'].".html";
		}elseif($parent['parent_id'] == 4){
			$vdata['aler1'] = $help['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$helpss[0]['id'].".html";
		}elseif($parent['parent_id'] == 5){
			$vdata['aler1'] = $guide['title'];
			$vdata['aler1_url'] = "/site/zhs_zhsjr/".$guidess[0]['id'].".html";
		}

		$vdata['aler2'] = $parent['title'];
		$vdata['aler2_url'] = "/site/zhs_zhsjr/".$article_obj['nid'].".html";
		
		$this->load->view("site/zhs_article" ,$vdata);
	}
}
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
